sui.ready(function() {

})

var vm = new Vue({
	el: "#datas",
	data: {
		currentPage: 1,
		indexs: [],
		allPage: 10,
		tabs: ["进出水量", "1#水泵机组", "2#水泵机组", "3#水泵机组"],
		selectTab: "",


		listDatas: []

	},
	mounted: function() {
		var index = []
		for (var i = 1; i <= this.allPage; i++) {
			index.push(i);
		}
		this.indexs = index;
		this.selectTab = this.tabs[0]
		this.pageClick(1);
	},
	methods: {



		pageClick: function(pageIndex) {
			this.currentPage = pageIndex;
			this.getDatas(this.currentPage);
		},
		prevPage: function() {
			this.currentPage--;
			if (this.currentPage < 1) {
				this.currentPage = 1
			}
			this.pageClick(this.currentPage);
		},
		nextPage: function() {
			this.currentPage++;
			if (this.currentPage > 20) {
				this.currentPage = 20
			}
			this.pageClick(this.currentPage);
		},

		tabSelect: function(tab) {
			this.selectTab = tab;
			this.listDatas = [];
			this.pageClick(1);
		},


		getDatas: function(page) {
			console.log("第" + page + "页");
			sui.loading();
			var _self = this;
			setTimeout(function() {
				sui.closeLoading();
				_self.setDatas(page);
			}, 1000);
		},

		setDatas: function(page) {
			var list = [];
			var begin = (page-1)*10;
			var end = page*10
			for(var i= begin+1 ; i<= end;i++){
				var w1 = getRandom(2000,4000);
				var w2= getRandom(1000,1567);
				
				list.push({
					id: i,
					time: getRandomDateStr(),
					type: w1,
					content: w2,
					deal: w1-w2,
				})
				
			}
			
			this.listDatas = list;	
		},

	},


})






